package top.hundreds.oasys.service;

import org.springframework.stereotype.Service;
import top.hundreds.common.crud.service.BaseService;
import top.hundreds.oasys.bean.entity.Papers;
import top.hundreds.oasys.mapper.PapersMapper;

/**
 * (Papers)表服务实现类
 *
 * @author lcf
 * @since 2021-01-29 19:18:36
 */
@Service("papersService")
public class PapersService extends BaseService<Papers, PapersMapper> {
    public String getFileType(String extName) {

        boolean isPng = "png".equalsIgnoreCase(extName);
        boolean isJpg = "jpg".equalsIgnoreCase(extName);
        boolean isJpeg = "jpeg".equalsIgnoreCase(extName);
        boolean isDoc = "doc".equalsIgnoreCase(extName);
        boolean isDocx = "docx".equalsIgnoreCase(extName);
        boolean isXls = "xls".equalsIgnoreCase(extName);
        boolean isXlsx = "xlsx".equalsIgnoreCase(extName);
        boolean isPPT = "ppt".equalsIgnoreCase(extName);
        boolean isPPTX = "pptx".equalsIgnoreCase(extName);
        boolean isRAR = "rar".equalsIgnoreCase(extName);
        boolean isZIP = "zip".equalsIgnoreCase(extName);
        boolean is7Z = "7z".equalsIgnoreCase(extName);
        if (isJpeg || isJpg || isPng) {
            return "img";
        }
        if (isDoc || isDocx) {
            return "doc";
        }
        if (isXlsx || isXls) {
            return "exc";
        }
        if (isPPTX || isPPT) {
            return "ppt";
        }
        if (isRAR || isZIP || is7Z) {
            return "zip";
        }
        return null;
    }
}
